package com.corpgovernment.common.mq.enums;

import lombok.Getter;
import com.ctrip.corp.obt.generic.utils.StringUtils;

/**
 * 短信业务类型枚举
 */
@Getter
public enum MessageBizTypeEnum {
    /**
     * 审批
     */
    APPROVAL("1", "审批", "approval-system-server", "approval_topic", "*"),
    LOGIN("2", "登录", null, null, ""),
    PAYPLATFORM("3", "支付", "pay-platform", "pay_topic", ""),
    ORDER_PUSH("4", "订单推送-国内机票订单", "pay-platform_flight", "order_push", "FN"),
    PAY_ORDER_PUSH("5", "订单推送支付推送", "pay-platform", "order_push", ""),
    PAY_TRAINORDER_PUSH("6", "火车订单推送支付推送", "pay-platform_train", "order_push", "TN"),
    FLIGHT_REBOOK("7", "机票改签", "flight-product", "flight_rebook", "FN"),
    TRAIN_REFUND("8", "火车退票", null, null, ""),
    TRAIN_TICKET_SUCCESS("9", "出票成功", null, null, ""),
    TRAIN_TICKET_FAIL("10", "出票失败", null, null, ""),
    TRAIN_CANCEL("11", "订单取消", null, null, ""),
    FLIGHT_ORDER_REFUND("12", "机票退款短信发送", null, null, ""),
    FLIGHT_TICKET_FAIL("13", "机票出票失败", null, null, ""),
    FLIGHT_TICKET_SUCCESS("14", "机票出票成功", null, null, ""),
    FLIGHT_CANCEL("15", "机票取消短信发送", null, null, ""),
    TRAIN_REBOOK_TICKET_SUCCESS("16", "火车票改签出票成功", null, null, ""),
    TRAIN_REBOOK_TICKET_FAIL("17", "火车票改签出票失败", null, null, ""),
    CAR_RTN_DISPATCHED_PASSENGER("18", "马上叫车司机接单（乘客）", null, null, ""),
    CAR_RTN_DISPATCHED_CONTACT("19", "马上叫车司机接单（联系人）", null, null, ""),
    CAR_RTN_CANCEL("20", "马上叫车取消订单", null, null, ""),
    CAR_RTN_PAID("21", "马上叫车支付成功", null, null, ""),
    PAY_CARORDER_PUSH("22", "马上叫车订单推送支付推送", "pay-platform_car", "order_push", "CN"),
    HOTEL_ORDER_PUSH("23", "订单推送-国内酒店订单", "pay-platform_hotel", "order_push", "HN"),
    IFLIGHT_ORDER_PUSH("24", "订单推送-国际机票订单", "pay-platform_iflight", "order_push", "FI"),
    CARTRANSFER_ORDER_PUSH("24", "订单推送-接送机/接送站", "pay-platform_carTransfer", "order_push", "PN||PM"),
	BUDGET_NOTIFY("25", "预算管控-阀值告警", "budget_manage", "org_company_topic", "budget"),
	USER_IDENTITY_PASS("24", "用户身份审核通过", null, null, ""),
    USER_IDENTITY_NO_PASS("25", "用户身份审核不通过", null, null, ""),
    /**
     * 初始化用户账户发送短信
     */
    USER_INITIAL_ACCOUNT("26", "初始化用户账户发送短信", null, null, ""),
    /**
     * 修改密码发送短信验证码
     */
    USER_MODIFY_PWD("27", "修改密码发送短信验证码", null, null, ""),
    /**
     * 用户注册发送短信验证码
     */
    USER_REGISTER("28", "用户注册发送短信验证码", null, null, ""),
    /**
     * 用户登录发送短信验证码
     */
    LOGIN_CONFIRM("29", "用户登录发送短信验证码", null, null, ""),
    /**
     * 重置员工密码
     */
    RESET_EMPLOYEE_PASSWORD("30", "重置员工密码", null, null, ""),
    /**
     * 添加员工成功
     */
    ADD_EMPLOYEE_SUCCESS("31", "添加员工成功", null, null, ""),
    FLIGHT_REFUND("32", "机票退票", null, null, ""),
    HOTEL_ORDER_CONFIRM("33", "酒店确认", null, null, ""),
    HOTEL_ORDER_CANCEL("34", "酒店订单取消", null, null, ""),
    MESSAGE_ADVICE("35", "短信发送失败重发", null, null, ""),

    /**
     * 审批流结束回调各产线
     */
    APPROVE_CALLBACK_APPLYTRIP("100", "审批结束回调出差申请", "approve_apply_trip", "approve_callback", "applytrip"),
    APPROVE_CALLBACK_FLIGHT("101", "审批结束回调机票", "approve_flight", "approve_callback", "flight"),
    APPROVE_CALLBACK_HOTEL("102", "审批结束回调酒店", "approve_hotel", "approve_callback", "hotel"),
    APPROVE_CALLBACK_TRAIN("103", "审批结束回调火车", "approve_train", "approve_callback", "train"),
    APPROVE_CALLBACK_INTL_FLIGHT("104", "审批结束回调国际机票", "approve_intl_flight", "approve_callback", "intl_flight"),
	APPROVE_CALLBACK_INTL_HOTEL("105", "审批结束回调酒店", "approve_intl_hotel", "approve_callback", "intl_hotel"),
	APPROVE_CALLBACK_CAR_TRANSFER("106", "审批结束回调接送机", "approve_car_tarnsfer", "approve_callback", "car_tarnsfer"),

    /**
     * 组织架构同步
     */
    SYNC_ORGANIZATION_ADD("42","同步组织信息（新增）","organization_manage_org","sync_organization","add"),
    SYNC_ORGANIZATION_UPDATE("43","同步组织信息（修改）","organization_manage_org","sync_organization","update"),
    SYNC_ORGANIZATION_DELETE("44","同步组织信息（删除）","organization_manage_org","sync_organization","delete"),
    /**
	 * 人员同步
	 */
	SYNC_EMPLOYEE_ADD("45", "同步人员信息（新增）", "employee_manage_org", "sync_employee", "add"),
	SYNC_EMPLOYEE_UPDATE("46", "同步人员信息（修改）", "employee_manage_org", "sync_employee", "update"),
	SYNC_EMPLOYEE_DELETE("47", "同步人员信息（删除）", "employee_manage_org", "sync_employee", "delete"),
	SYNC_EMPLOYEE_NEW("45", "同步人员信息", "employee_manage_org", "sync_employee", "employee"),

	IHOTEL_ORDER_PUSH("48", "订单推送-海外酒店订单", "pay-platform_ihotel", "order_push", "HI"),

	SEND_MESSAGE("50", "发送短信消息站内信", "basic-server", "send_message", "message"),
    SEND_EMAIL("51", "发送邮件", "basic-server-email", "send_email", "email"),
	ORDER_STATUS_TOPIC("50", "更新订单中心状态", "order-center-server", "order_status_topic", ""),
	/**
	 * 订单同步
	 */
	SYNC_ORDER_STATUS_RECORD("80", "同步订单状态记录", "order-center", "order_status_record_topic", "*"),
	SYNC_ORDER_STATUS("81", "同步订单状态", "order-center", "order_status_topic", "*"),

    EMPLOYEE_OPEN_CARD("90", "员工开卡", "employee_open_card", "employee_open_card", ""),
    GET_OPEN_CARD_INFO("91", "获取员工开卡信息", "get_open_card_info", "get_open_card_info", ""),
    SYNC_EMPLOYEE_INFO("92", "同步人员信息", "sync_employee_info", "sync_employee_info", ""),
    SUPPLIER_PUSH("93", "供应商推送通知", "supplier_push", "supplier_push", ""),
	;

	/**
	 * 业务code
	 */
	private String code;
	/**
	 * 业务描述
	 */
    private String desc;
    /**
     * 业务消费的group
     */
    private String groupName;
    /**
     * 业务topic
     */
    private String topic;

    /**
     * 业务topic下的不同tags
     */
    private String tags;

    MessageBizTypeEnum(String code, String desc, String groupName, String topic, String tags) {
        this.code = code;
        this.desc = desc;
        this.groupName = groupName;
        this.topic = topic;
        this.tags = tags;
    }

    public static MessageBizTypeEnum getTopic(String code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (MessageBizTypeEnum bizTypeEnum : MessageBizTypeEnum.values()) {
            if (code.equals(bizTypeEnum.getCode())) {
                return bizTypeEnum;
            }
        }
        return null;
    }
}
